<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>basic</title>
    <style>
        .test1{
            color:red;
        }
        .test1{
            color:blue;
        }
        
        /* !important 标记防止被同一级别的覆盖 */
        .test2{
            color:red!important;
        }

        .test2{
            color:blue;
        }

/* 这个不会生效,被上面同一级别的!important覆盖 */
        body .test2{
            color:green;
        }
        
        #test3{
            color:red;
        }
    </style>
</head>
<body class="body" id="body">
    <div class="test1">test1</div>
    <div class="test2">test2</div>
    <div id="test3" style="color:blue">
        test3
    </div>
</body>
</html>